package top.winshu.common.web.context;

import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Date;
import java.util.Map;

/**
 * @author winshu
 * @since 2020/10/22
 **/
public class RequestContext implements Serializable {

    private Object[] args;

    private String controller;

    private String method;

    private String url;

    private String address;

    private Map<String, String> headers;

    private final Date time;

    public RequestContext() {
        this.time = new Date();
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }

    public void setController(String controller) {
        this.controller = controller;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Date getTime() {
        return time;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSignature() {
        return MessageFormat.format("{0}.{1}", controller, method);
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }
}
